<template name="trailerStars">
	<view class="movice-score-wapper">

		<image class="star-ico" v-for="yellow in yelloScore" src="/static/icos/star-yellow.png" mode=""></image>
		<image class="star-ico" v-for=" gray in grayScore" src="/static/icos/star-gray.png" mode=""></image>
		<view class="movice-score" v-if="showNum == 1">{{innerScore}}</view>
	</view>
</template>

<script>
	export default {
		props: {
			innerScore: 0, //分数
			showNum: 0 //默认不显示
		},
		name: "trailerStars",
		data() {
			return {
				yelloScore: 0,
				grayScore: 5
			};
		},

		// 生命周期，组件创建完成后被调用
		created() {
			console.log("this.innerScore=" + this.innerScore)
			var tempScore = 0;
			if (this.innerScore != null && this.innerScore != undefined && this.innerScore != '') {
				tempScore = this.innerScore;
			}

			var yelloScore = parseInt(tempScore / 2);
			var grayScore = 5 - yelloScore;

			this.yelloScore = yelloScore;
			this.grayScore = grayScore;
		}
	}
</script>

<style>
	.movice-score-wapper {
		display: flex;
		flex-direction: row;

	}

	.star-ico {
		width: 20upx;
		height: 20upx;
		margin-top: 6upx;
	}

	.movice-score {
		font-size: 12px;
		color: grey;
		margin-left: 8upx;
	}
</style>
